package com.coocaa.ops.admin.v1.todotask.provider.impl;

import com.coocaa.ops.admin.base.AbstractBizImpl;
import com.coocaa.ops.admin.v1.tab.biz.impl.TabInfoBizImpl;
import com.coocaa.ops.admin.v1.todotask.convert.DraftQueryConverter;
import com.coocaa.ops.admin.v1.todotask.model.AuditTaskInfoModel;
import com.coocaa.ops.admin.v1.todotask.provider.AbstractDraftTaskQueryProviderImpl;
import com.coocaa.ops.common.core.biz.tab.entity.TabInfoEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author bijiahao
 * @description
 * @date 2020/6/22 18:13
 */
@Service
public class TabDraftTaskQueryProvider extends AbstractDraftTaskQueryProviderImpl<TabInfoEntity>{
    @Autowired
    private TabInfoBizImpl tabInfoBiz;
    @Override
    public AbstractBizImpl getAbstractBizImpl() {
        return tabInfoBiz;
    }

    @Override
    protected Map<String, Object> convertQueryParams(AuditTaskInfoModel model, Integer userId) {
        Map<String, Object> map = DraftQueryConverter.getQueryParams(model, userId);
        if (StringUtils.isNotBlank(model.getTaskName())) {
            map.put("tabName", model.getTaskName());
        }
        if (model.getTaskId() != null) {
            map.put("id", model.getTaskId());
        }
        return map;
    }
}
